/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.bs.beans.fiscal;

import java.beans.PropertyChangeListener;
import java.beans.PropertyChangeSupport;
import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.OneToOne;
import javax.persistence.PrimaryKeyJoinColumn;
import javax.persistence.Table;
import javax.persistence.Transient;

/**
 *
 * @author Bone
 */
@Entity
@Table(name = "VEICULO_TRANSPORTE")
public class VeiculoTransporte implements Serializable {
    @Transient
    private PropertyChangeSupport changeSupport = new PropertyChangeSupport(this);
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @Column(name = "ID")
    private Integer id;
    @Column(name = "PLACA")
    private String placa;
    @Column(name = "UF")
    private Integer uf;
    @OneToOne(mappedBy = "id")
    @PrimaryKeyJoinColumn
    private RetencaoIcmsTransporte retencaoIcmsTransporte;

    public VeiculoTransporte() {
    }

    public VeiculoTransporte(Integer id) {
        this.id = id;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        Integer oldId = this.id;
        this.id = id;
        changeSupport.firePropertyChange("id", oldId, id);
    }

    public String getPlaca() {
        return placa;
    }

    public void setPlaca(String placa) {
        String oldPlaca = this.placa;
        this.placa = placa;
        changeSupport.firePropertyChange("placa", oldPlaca, placa);
    }

    public Integer getUf() {
        return uf;
    }

    public void setUf(Integer uf) {
        Integer oldUf = this.uf;
        this.uf = uf;
        changeSupport.firePropertyChange("uf", oldUf, uf);
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof VeiculoTransporte)) {
            return false;
        }
        VeiculoTransporte other = (VeiculoTransporte) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "Apagar.VeiculoTransporte[ id=" + id + " ]";
    }

    public void addPropertyChangeListener(PropertyChangeListener listener) {
        changeSupport.addPropertyChangeListener(listener);
    }

    public void removePropertyChangeListener(PropertyChangeListener listener) {
        changeSupport.removePropertyChangeListener(listener);
    }

    public RetencaoIcmsTransporte getRetencaoIcmsTransporteCollection() {
        return retencaoIcmsTransporte;
    }

    public void setRetencaoIcmsTransporteCollection(RetencaoIcmsTransporte retencaoIcmsTransporte) {
        RetencaoIcmsTransporte old = this.retencaoIcmsTransporte;
        this.retencaoIcmsTransporte = retencaoIcmsTransporte;
        changeSupport.firePropertyChange("retencaoIcmsTransporte", old, retencaoIcmsTransporte);
    }
    
}
